package com.algorithm.map;

import com.algorithm.avltree.AVLTree;

/**
 * @Author: DOWN
 * @Date: 2022/8/1 10:01
 * @Comment: AVL实现Map
 */
public class AVLRealizeMap<K extends Comparable<K>, V> implements MapInterface<K, V> {

    private AVLTree<K, V> avlTree;

    public AVLRealizeMap() {
        avlTree=new AVLTree<>();
    }

    @Override
    public void add(K key, V value) {
        avlTree.add(key,value);
    }

    @Override
    public V remove(K key) {
        return avlTree.remove(key);
    }

    @Override
    public boolean contains(K key) {
        return avlTree.contains(key);
    }

    @Override
    public V get(K key) {
        return avlTree.get(key);
    }

    @Override
    public void set(K key, V newValue) {
        avlTree.set(key,newValue);
    }

    @Override
    public int getSize() {
        return avlTree.getSize();
    }

    @Override
    public boolean isEmpty() {
        return avlTree.isEmpty();
    }
}
